<extend name="Public/base" />
<block name="style">

</block>
<block name="body">

    <!-- 标题栏 -->
    <div class="main-title">
        <h2>车队管理</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <form action="" method="POST">
                <input type="text" name="keywords" class="text input-4x" value="{$keywords}" placeholder="车队名称/联系人/电话搜索" />&nbsp; &nbsp;
                <button class="btn" type="submit">筛选</button>
            </form>
            <!--            <a class="btn" href="{:U('add')}">新 增</a>-->
            <!--            <button class="btn ajax-post confirm" url="{:U('changeStatus?method=deleteUser')}" target-form="ids">删 除</button>-->
        </div>
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <a class="btn" href="{:U('add')}">新 增</a>

            <!--<a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>-->
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
                <tr>
                    <th class="">车队ID</th>
                    <th class="">车队名称</th>
                    <th class="">车队联系人</th>
                    <th class="">联系电话</th>
                    <th class="">车队登录账号</th>
                    <th class="">用户状态</th>
                    <th class="">操作</th>
                </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td>{$vo.fleet_id} </td>
                        <td>{$vo.fleet_name}</td>
                        <td>{$vo.fleet_linkman}</td>
                        <td>{$vo.fleet_phone}</td>
                        <td>{$vo.fleet_login_name}</td>

                        <td><eq name="vo['status']" value="1">正常<else/>禁用</eq></td>
                    <td>
                        <a href="{:U('add',array('id'=>$vo['fleet_id']))}" class="">编辑</a>
                        <a href="javascript:;" data-id="{$vo['uid']}"  class="tongyi">重置密码</a>
                        <eq name="vo['status']" value="0">
                        <a href="{:U('changestatus',array('id'=>$vo['uid'],'status'=>1))}" class="confirm ajax-get">启用</a>
                    <else />
                    <a href="{:U('changestatus',array('id'=>$vo['uid'],'status'=>0))}" class="confirm ajax-get">禁用</a>
                    </eq>
                    </td>   
                    </tr>
                </volist>
                <else/>
                <td colspan="20" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
    <div class="show-box-back"  style="display: none;">
    </div>
    <!-- 审核通过框 -->
    <div class="show-box" id="js-tongguo" style="display: none;">
        <input type="hidden" id="js-tongguo-id">
        <div class="show-box-msg" >
            提示
        </div>
        <div class="show-box-msg-content">
            重置后登录密码为123456,确定重置该车队密码吗?
        </div>
        <div class="show-box-bottom">
            <button class="js-show-btn-cancel btn btn-return " >返 回</button>
            <button class="js-show-btn-ok btn submit-btn" id="submit-tongguo" >确 定</button>

        </div>
    </div>

</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //搜索功能
        $(".tongyi").click(function () {
            var id = $(this).attr("data-id");
            $('#js-tongguo').show();
            $('.show-box-back').show();
            $('#js-tongguo-id').val(id);
        });

        $("#submit-tongguo").click(function () {

            var id = $("#js-tongguo-id").val();
            $.post("{:U('changestatus')}", {id: id, repwd: 1}, function (res) {
                if (res.status) {
                    updateAlert('重置成功', 'alert-success');
                    setTimeout(function () {
                        location.reload();
                    }, 1500);
                }
            });
        });

        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮

        highlight_subnav("{:U('Fleet/index')}");
    </script>
</block>
